package com.aaa.service.impl;

import com.aaa.controller.ContractLeaseController;
import com.aaa.entity.DO.ContractLease;
import com.aaa.entity.DO.RentCaptureOperation;
import com.aaa.entity.VO.ContractLeaseCapture;
import com.aaa.entity.result.Result;
import com.aaa.mapper.ContractLeaseMapper;
import com.aaa.service.ContractLeaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author ：陈凯歌
 * @date ：Created in 2021/1/19 11:03
 * @description：
 * @modified By：
 * @version:
 */
@Service
public class ContractLeaseServiceImpl implements ContractLeaseService {

    @Autowired
    private ContractLeaseMapper mapper;

    /**
     * 查询所有应交租金
     * @return
     */
    @Override
    public Result getRnt() {

       // List<ContractLease> list = mapper.rentMsg();
        // Map<Object, Object> list = mapper.listAll();
        List<ContractLease> list = mapper.listAll();
        System.out.println("--------------"+list+"-----------------");
        if (list!=null &&list.size()>0){
            return Result.succeed(list);
        }
        return Result.error("查询失败");
    }

    /**
     * 根据前端请求id查询应交租金操作
     * @param id
     * @return
     */
    @Override
    public Result getOperation(Integer id) {

        //调用particulars方法查询
        List<RentCaptureOperation> particulars = mapper.particulars(id);
        //判断查询出集合不为空且长度大于0
        if (particulars!=null &&particulars.size()>0) {
            return Result.succeed(particulars);
        }
        return Result.error("查询失败");
    }




}
